﻿/*
 ***************************************************************************
 * Microsoft Visual C# .NET
 * 名称：       App_System_DispatchMenuPart
 * 类型：       控制层

 * 功能说明：   显示按钮区
 *              
 * 作者：       谈震鸣
 * 创建日期：   2007/12/14
 * 修改日期     修改者      修改内容
 * 
 * 
 * ---
 ***************************************************************************
*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Shpm.App.Input.Bean;
using Shpm.App.Input.Dao;
using Shpm.App.Commons.Utils;
using Shpm.System;
using Shpm.App.Commons.Db.Beans.Master;
public partial class App_System_DispatchMenuPart : System.Web.UI.UserControl
{
    private const string PERSON_DEPART_ID = "2";  //人事部门编号
    private const string SALE_DEPART_ID   = "4";  //销售部门编号
    private const string HEALTH_DEPART_ID = "6";  //生活部门编号
    private string strDepartId;
    protected void Page_Load(object sender, EventArgs e)
    {
        SysUserManager manager = new SysUserManager(Context);
        SysUserBean sysUserBean = manager.getSysUserBean();
        IList DepartList = sysUserBean.getDepartments();

        if (DepartList.Count > 0)
        {
            MstDepartmentBean dtBean = (MstDepartmentBean)DepartList[0];
            strDepartId = dtBean.DepartId;
        }
        else
        {
            strDepartId = string.Empty;
        }

        if (strDepartId != string.Empty)
        {
            //构建销售对象
            if (strDepartId == SALE_DEPART_ID)
            {
                //((HtmlContainerControl)Sales).Style.Add("display", "");
                Control ctrl = LoadControl("~/App/System/SalesMenuPart.ascx");
                this.Controls.Add(ctrl);
            }
            //构建生活健康对象
            else if (strDepartId == HEALTH_DEPART_ID)
            {
                //((HtmlContainerControl)Health).Style.Add("display", "");
                Control ctrl = LoadControl("~/App/System/HealthMenuPart.ascx");
                this.Controls.Add(ctrl);
            }
            //构建人事对象
            else if (strDepartId == PERSON_DEPART_ID)
            {
                //((HtmlContainerControl)Person).Style.Add("display", "");
                Control ctrl = LoadControl("~/App/System/PersonMenuPart.ascx");
                this.Controls.Add(ctrl);
            }
            //其他
            else
            {
                //((HtmlContainerControl)Common).Style.Add("display", "");
                Control ctrl = LoadControl("~/App/System/CommonMenuPart.ascx");
                this.Controls.Add(ctrl);
            }
        }
    }
}
